<?php
$currentPageLocation = pc_variable("currentPage.location");
$loginPageLocation = "/dispatcher.php?controller=Commerce/LogInCustomer";
$registerPageLocation = "/dispatcher.php?controller=Commerce/StartRegisterCustomer";
$targetPageLocation = pc_variable("targetPage.location");
if($targetPageLocation === null && $currentPageLocation != $registerPageLocation && $currentPageLocation != $loginPageLocation) {
    $targetPageLocation = $currentPageLocation;
}
if($targetPageLocation === null) {
    $targetPageLocation = "/";
}
?>
<div class="panel">
    <h3><?php pc_echo(pc_message("common.sidebar.account.title")); ?></h3>
<?php 
if(pc_variable("commerce.customer") !== null) {
    pc_pagelet("common/account-logged-in",
        array("targetPage.location" => $targetPageLocation));
} else {
    pc_pagelet("common/account-logged-out",
        array("targetPage.location" => $targetPageLocation));
} ?>
</div>